#pragma once

using namespace Microsoft::WRL;
using namespace Windows::ApplicationModel;

// Manage Direct2D resources
ref class D2DManager sealed{

	static D2DManager^ m_instance;

	// Resources
	ComPtr<ID2D1Factory2> m_d2dFactory;
	ComPtr<IWICImagingFactory2> m_wicFactory;
	ComPtr<IDXGIDevice3>	m_dxgiDevice;
	ComPtr<ID2D1Device1> m_d2dDevice;
	ComPtr<ID2D1DeviceContext1> m_d2dDeviceContext;

	void App_Suspending(Object^ sender, SuspendingEventArgs^ e);

public:

	// Instance
	static D2DManager^ GetInstance();	

	D2DManager();
internal:
	// Resources Accessors
	ID2D1Factory2* const GetD2DFactory(){ return m_d2dFactory.Get(); }
	IWICImagingFactory2* const GetWICImagingFactory(){ return m_wicFactory.Get(); }
	IDXGIDevice3* const GetDXGIDevice(){ return m_dxgiDevice.Get(); }
	ID2D1Device1* const GetD2DDevice(){ return m_d2dDevice.Get(); }
	ID2D1DeviceContext1* const GetD2DDeviceContext(){ return m_d2dDeviceContext.Get(); }

};